package cn.com.customer.manager.ui.message.notice

import cn.com.customer.manager.bean.MessageListInfo
import cn.com.customer.manager.bean.RequestBean
import cn.com.customer.manager.http.BaseApi
import cn.com.customer.manager.http.subscriber.TipRequestSubscriber
import com.xuexiang.xhttp2.XHttp
import com.xuexiang.xhttp2.XHttpProxy
import com.xuexiang.xhttp2.annotation.ThreadType
import com.xuexiang.xhttp2.model.ApiResult
import com.xuexiang.xutil.net.JsonUtil
import com.xuexiang.xutil.tip.ToastUtils

class NoticePresenter constructor(view: NoticeContract.View): NoticeContract.Presenter {
    private val mView = view
    init {
        mView.setPresenter(this)
    }
    override fun getNoticeData(params: Map<String, String>) {
        val request = XHttp.custom()
        request.call(request.create(BaseApi.IMessage::class.java)
                .noticeList(RequestBean(params)))
                .subscribeWith(object : TipRequestSubscriber<ApiResult<MessageListInfo>?>() {
                    override fun onSuccess(apiResult: ApiResult<MessageListInfo>?) {
                         apiResult?.let {
                             mView.setNoticeDate(it.data)
                         }
                    }
                })
    }

    override fun start() {

    }
}